﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using ICarPool.DBCommon;

namespace ICarPool.DAL.Sql
{
    public class BaseDAL
    {
        #region 属性
        public SqlConnection Connection { get; set; }
        #endregion

        public BaseDAL()
        {
            this.Connection = new SqlConnection(DBUtility.GetConnectionString());
        }

        /// <summary>
        /// 打开默认连接
        /// </summary>
        public void OpenConnection()
        {
            if (this.Connection.State != System.Data.ConnectionState.Open)
            {
                this.Connection.Open();
            }
        }

        public void CloseConnection()
        {
            this.Connection.Close();
        }
    }
}
